package com.feib.soeasy.model;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;


/**
 * @title (#)WriteOffPayment.java<br>
 * @description 銷帳資料<br>
 * @author Jimmy Liu<br>
 * @version 1.0.0 2010/11/25
 * @copyright Far Eastern International Bank Copyright (c) 2010<br>
 * @2010/11/8 create by Jimmy Liu<br>
 */
@Entity
@Table(name = "WRITE_OFF_PAYMENT")
public class WriteOffPayment extends AuditEntity {

    private static final long serialVersionUID = -8814725069459473700L;
    
    /**
     * 繳款通路代碼類別
     */
    public static final String FILE_STATUS_CODE_KIND = "CHANEL";
    
    /**
     * 通路-臨櫃繳款 (帳單逾期可收)
     */
    public static final String CHANNEL_COUNTER = "0";
    
    /**
     * 通路-網路銀行(包含SOEZ0001、SOEZ1002線上繳款) (帳單逾期可收)
     */
    public static final String CHANNEL_INTERNET_ATM = "1";
    
    /**
     * 通路-ATM 或 網路ATM (帳單逾期可收)
     */
    public static final String CHANNEL_WEB_ATM = "2";
    
    /**
     * 通路-中心轉帳BIO (帳單逾期可收)
     */
    public static final String CHANNEL_BIO = "3";
    
    /**
     * 通路-自行XML (帳單逾期可收)
     */
    public static final String CHANNEL_XML = "4";
    
    /**
     * 通路-跨行繳款 (帳單逾期可收)
     */
    public static final String CHANNEL_INTERBANK= "8";
    
    /**
     * 通路-自行繳款 (帳單逾期可收)
     */
    public static final String CHANNEL_SELF = "Z";
    
    /**
     * 通路-7-11 (帳單逾期不可收)
     */
    public static final String CHANNEL_7_11 = "D";
    
    /**
     * 通路-OK (帳單逾期不可收)
     */
    public static final String CHANNEL_OK_MART = "E";
    
    /**
     * 通路-全家 (帳單逾期不可收)
     */
    public static final String CHANNEL_FAMILY_MART = "F";
    
    /**
     * 通路-萊爾富 (帳單逾期不可收)
     */
    public static final String CHANNEL_HILIFE = "G";
    
    /**
     * 通路-郵局 (帳單逾期不可收)
     */
    public static final String CHANNEL_POST = "H";
    
    /**
     * ACH
     */
    public static final String CHANNEL_ACH = "I";/* 2012/05/21 ACH通路代碼為I */

    /**
     * 銷帳狀態-正常
     */
    public static final Integer WRITEOFF_STATUS_OK = new Integer(1);

    /**
     * 銷帳狀態-異常
     */
    public static final Integer WRITEOFF_STATUS_ERROR = new Integer(2);

    /**
     * 銷帳狀態-人工銷帳-待放行
     */
    public static final Integer WRITEOFF_STATUS_Z_WAITING_CONFIRM = new Integer(3);

    /**
     * 銷帳狀態-人工銷帳-不放行
     */
    public static final Integer WRITEOFF_STATUS_Z_CONFIRM_NOT_OK= new Integer(4);

    /**
     * 銷帳狀態-沖正銷帳<BR/>
     * 由[銀行代收通路銷帳批次回饋程式]沖正銷帳<BR/>
     * 即原本已銷帳改為待繳款
     */
    public static final Integer WRITEOFF_STATUS_ROLL_BACK_WRITEOFF= new Integer(5);
    
    
    /**
     * PK in Table
     */
    private Long writeOffPaymentPk;
    
    /**
     * 銷哪一筆繳費單
     */
    private Payment payment;
    
    /**
     * 銷帳金額
     */
    private Long amount;
    
    /**
     * 交易日期
     */
    private Date txDate;
    
    /**
     * 銷帳日期
     */
    private Date writeOffDate;
  
    /**
     * 銷帳原因編號
     */
    private String writeOffNo;
    
    /**
     * 繳款通路</br>
     * 0: 通路-臨櫃繳款 (帳單逾期可收)
     * 1: 網路銀行(包含SOEZ0001、SOEZ1002線上繳款，此時 rlFlag = true) (帳單逾期可收)</br>
     * 2: ATM 或 網路ATM (帳單逾期可收)</br>
     * 3: 中心轉帳BIO (帳單逾期可收)</br>
     * 4: 自行XML (帳單逾期可收)</br>
     * 8: 跨行繳款 (帳單逾期可收)</br>
     * Z: 自行繳款 (帳單逾期可收)</br>
     * D: 7-11 (帳單逾期不可收)</br>
     * E: 全家 (帳單逾期不可收)</br>
     * F: 萊爾富 (帳單逾期不可收)</br>
     * G: OK (帳單逾期不可收)</br>
     * H: 郵局 (帳單逾期不可收)</br>
     * I: ACH</br>
     */
    private String channel;
    
    /**
     * 線上繳款(可列印收據)
     */
    private Boolean rlFlag;
    
    /**
     * 銷帳人員<br>
     * 自行繳款(channel=Z)時才會使用<br>
     * 若是系統批次銷帳，則此欄位空白<br>
     */
    private User writeOffUser;
    
    /**
     * 確認放行日期<br>
     * 自行繳款(channel=Z)時才會使用<br>
     * 若是系統批次銷帳，則此欄位空白<br>
     */
    private Date confirmDate;
    
    /**
     * 確認放行人員<br>
     * 自行繳款(channel=Z)時才會使用<br>
     * 若是系統批次銷帳，則此欄位空白<br>
     */
    private User confirmUser;
    
    /**
     * 銷帳狀態<br>
     * 1: 正常<br>
     * 2: 異常<br>
     * 3: 人工銷帳-待放行<br>
     * 4: 人工銷帳-不放行<br>
     */
    private Integer writeOffStatus;
    
    /**
     * 批次銷帳日誌PK
     */
    private Long feedbackUid;
    
    private String writeOffNote;

    
    /**
     * @return the writeOffPaymentPk
     */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name="WRITE_OFF_PAYMENT_PK", nullable=false)
    public Long getWriteOffPaymentPk() {
        return writeOffPaymentPk;
    }

    
    /**
     * @param writeOffPaymentPk the writeOffPaymentPk to set
     */
    public void setWriteOffPaymentPk(Long writeOffPaymentPk) {
        this.writeOffPaymentPk = writeOffPaymentPk;
    }

    
    /**
     * @return the payment
     */
    @ManyToOne
    @JoinColumn(name="PAYMENT_PK")
    public Payment getPayment() {
        return payment;
    }

    
    /**
     * @param payment the payment to set
     */
    public void setPayment(Payment payment) {
        this.payment = payment;
    }

    
    /**
     * @return the amount
     */
    @Column(name="AMOUNT", nullable=false)
    public Long getAmount() {
        return amount;
    }

    
    /**
     * @param amount the amount to set
     */
    public void setAmount(Long amount) {
        this.amount = amount;
    }

    
    /**
     * @return the writeOffDate
     */
    @Column(name="WRITE_OFF_DATE", nullable=false)
    public Date getWriteOffDate() {
        return writeOffDate;
    }

    
    /**
     * @param writeOffDate the writeOffDate to set
     */
    public void setWriteOffDate(Date writeOffDate) {
        this.writeOffDate = writeOffDate;
    }

    
    /**
     * @return the channel
     */
    @Column(name="CHANNEL", nullable=false, length=2)
    public String getChannel() {
        return channel;
    }

    
    /**
     * @param channel the channel to set
     */
    public void setChannel(String channel) {
        this.channel = channel;
    }


    
    
    /**
     * @return the rlFlag
     */
    @Column(name="RL_FLAG")
    public Boolean getRlFlag() {
        return rlFlag;
    }


    
    /**
     * @param rlFlag the rlFlag to set
     */
    public void setRlFlag(Boolean rlFlag) {
        this.rlFlag = rlFlag;
    }


    /**
     * @return the writeOffUser
     */
    @ManyToOne
    @JoinColumn(name="WRITE_OFF_USER_PK")
    public User getWriteOffUser() {
        return writeOffUser;
    }


    
    /**
     * @param writeOffUser the writeOffUser to set
     */
    public void setWriteOffUser(User writeOffUser) {
        this.writeOffUser = writeOffUser;
    }


    
    /**
     * @return the confirmDate
     */
    @Column(name="CONFIRM_DATE")
    public Date getConfirmDate() {
        return confirmDate;
    }


    
    /**
     * @param confirmDate the confirmDate to set
     */
    public void setConfirmDate(Date confirmDate) {
        this.confirmDate = confirmDate;
    }


    
    /**
     * @return the confirmUser
     */
    @ManyToOne
    @JoinColumn(name="CONFIRM_USER_PK")
    public User getConfirmUser() {
        return confirmUser;
    }


    
    /**
     * @param confirmUser the confirmUser to set
     */
    public void setConfirmUser(User confirmUser) {
        this.confirmUser = confirmUser;
    }


    
    /**
     * @return the writeOffStatus
     */
    @Column(name="WRITE_OFF_STATUS", nullable=false)
    public Integer getWriteOffStatus() {
        return writeOffStatus;
    }


    
    /**
     * @param writeOffStatus the writeOffStatus to set
     */
    public void setWriteOffStatus(Integer writeOffStatus) {
        this.writeOffStatus = writeOffStatus;
    }


    
    /**
     * @return the feedbackUid
     */
    @Column(name="FEEDBACK_UID")
    public Long getFeedbackUid() {
        return feedbackUid;
    }


    
    /**
     * @param feedbackUid the feedbackUid to set
     */
    public void setFeedbackUid(Long feedbackUid) {
        this.feedbackUid = feedbackUid;
    }


    
    /**
     * @return the txDate
     */
    @Column(name="TX_DATE")
    public Date getTxDate() {
        return txDate;
    }


    
    /**
     * @param txDate the txDate to set
     */
    public void setTxDate(Date txDate) {
        this.txDate = txDate;
    }


    
    /**
     * @return the writeOffNote
     */
    @Column(name="WRITE_OFF_NOTE", length=200)
    public String getWriteOffNote() {
        return writeOffNote;
    }


    
    /**
     * @param writeOffNote the writeOffNote to set
     */
    public void setWriteOffNote(String writeOffNote) {
        this.writeOffNote = writeOffNote;
    }

	/**
	 * @return the writeOffNo
	 */
	@Column(name="WRITE_OFF_NO", length=20)
	public String getWriteOffNo() {
		return writeOffNo;
	}


	/**
	 * @param writeOffNo the writeOffNo to set
	 */
	public void setWriteOffNo(String writeOffNo) {
		this.writeOffNo = writeOffNo;
	}

    
}
